{template 'member','header'}
<script type="text/javascript" src="images/js/form.js"></script>
<script type="text/javascript" src="images/js/validator.js"></script>

<div id="main">
  <div id="left">
    <div id="treemenu">
      <h5>信息管理</h5>
      <ul>
        <li><a href="manage.php?action=add&catid={$catid}">发布信息</a></li>
		{loop $STATUS $k $name}
        <li><a href="manage.php?status={$k}">{$name}</a></li>
		{/loop}
      </ul>
    </div>
    <ol>
      <li class="local"><a href="">返回网站首页</a></li>
      <li class="exit"><a href="{$MODULE[member][url]}logout.php">退出登录</a></li>
    </ol>
  </div>
  <div id="right">

	<p id="position"><strong>当前位置：</strong><a href="{$MODULE[member][url]}">会员中心</a><a href="manage.php">信息管理</a>{$position}</p>
	<div class="clear"></div>
	<div class="clear"></div>
{if $action == 'add'}
<form action="manage.php?action={$action}&catid={$catid}&modelid={$modelid}" method="post" name="myform"  enctype="multipart/form-data">
<table cellpadding="0" cellspacing="1" class="table_form">
	<caption>发布信息</caption>
    {loop $forminfos $field $info}
	<tr> 
      <th width="20%"> {if $info['star']} <font color="red">*</font>{/if} <strong>{$info[name]}</strong><br />
	  {$info[tips]}
	  </th>
      <td>{$info[form]} </td>
    </tr>
	{/loop}
    <tr> 
      <td></td>
      <td> 
	  <input type="hidden" name="forward" value="{$forward}"> 
	  <input type="submit" name="dosubmit" value=" 确定 "> 
      <input type="reset" name="reset" value=" 清除 ">
	  <input type="button" name="preview" value=" 预览 " onclick="preview_content();">
	  </td>
    </tr>
</table>
</form>

{elseif $action == 'edit'}
<form action="manage.php?action={$action}&catid={$catid}&modelid={$modelid}&contentid={$contentid}" method="post" name="myform"  enctype="multipart/form-data">
<table cellpadding="0" cellspacing="1" class="table_form">
	<caption>修改信息</caption>
    {loop $forminfos $field $info}
	<tr> 
      <th width="20%">{if $info['star']} <font color="red">*</font>{/if} <strong>{$info[name]}</strong><br />
	  {$info[tips]}
	  </th>
      <td>{$info[form]} </td>
    </tr>
	{/loop}
    <tr> 
      <td></td>
      <td> 
	  <input type="hidden" name="forward" value="{$forward}"> 
	  <input type="submit" name="dosubmit" value=" 确定 "> 
      <input type="reset" name="reset" value=" 清除 ">
	  <input type="button" name="preview" value=" 预览 " onclick="preview_content();">
	  </td>
    </tr>
</table>
</form>

{elseif $action == 'preview'}

 <table cellpadding="0" cellspacing="1" class="table_form">
  <caption>预览信息</caption>
    {loop $info $k $v}
	<tr> 
      <th width="25%"><b>{$fields[$k][name]}：</b></th>
      <td>{$v}</td>
    </tr>
    {/loop}
</table>

{else}

{if !$catid || $child}

<table cellpadding="0" cellspacing="1" class="table_list">
  <caption>信息管理</caption>
	 <tr>
		<th>栏目</th>
		<th>信息数</th>
		<th>管理操作</th>
	 </tr>
	 {$categorys}
</table>

{else}

<form name="myform" method="post" action="manage.php?action=delete" >
<table cellpadding="0" cellspacing="1" class="table_list">
  <caption>管理信息</caption>
	<tr>
	{if $status!=99}
    <th width="40">选中</th>
    {/if}
	<th width="45">ID</th>
	<th>标题</th>
	<th width="70">更新时间</th>
	<th width="120">管理操作</th>
	</tr>
    {loop $data $r}
	<tr>
    {if $status!=99}
	<td><input type="checkbox" name="contentid[]" value="{$r[contentid]}" id="content_{$r[contentid]}" /></td>
    {/if}
	<td>{$r[contentid]}</td>
	<td class="align_left"><a href="{$r[url]}" target="_blank">{output::style($r['title'], $r['style'])}</a></td>
	<td class="align_c">{date('Y-m-d',$r[updatetime])}</td>
	<td class="align_c">
	<a href="manage.php?action=preview&contentid={$r[contentid]}">预览</a> 
	{if $status!=99}
	| <a href="manage.php?action=edit&contentid={$r[contentid]}">修改</a> | 
    <a href="javascript:if(confirm('确定要删除吗？')) location='manage.php?action=delete&contentid={$r[contentid]}'">删除</a> 
	{else}
    | <a href="{$MODULE[comment][url]}?keyid=phpcms-content-title-{$r[contentid]}&verify={md5('phpcms-content-title-'.$r[contentid].AUTH_KEY)}">评论</a>
    {/if}
    </td>
	</tr>
    {/loop}
</table>
    <div class="button_box">
    {if $status!=99}<input type="submit" name="button2" id="button" value="删除信息" />{/if}
    </div>
</form>
<div id="pages"><?=$c->pages?></div>

{/if}

{/if}
  </div>
</div>
<script LANGUAGE="javascript">
<!--
function preview_content()
{
	myform.action = "preview.php";
	myform.target = "_blank"; 
	myform.submit(); 
	myform.action = "manage.php?action={$action}&catid={$catid}&modelid={$modelid}&contentid={$contentid}";
	myform.target="_self";
}
$().ready(function() {
	$('form').checkForm(1);
{loop $member_detail $field $detail}
	$('#{$field}').val('{$detail}');
{/loop}
	});
//-->
</script>
{template 'phpcms','footer'}